//引入api
import {
    requestCateGoryList
} from "@/api"

//home模块的配置
const state = {
    cateGoryList: []
}

const mutations = {
    //修改cateGoryList的函数
    SET_CATEGORYLIST_STATE(state , value){
        state.cateGoryList = value
    }
}

const actions = {
     async getCateGoryList({commit}){
        //发送请求拿到数据
        const result = await requestCateGoryList()
        //提交到mutations修改数据
        commit("SET_CATEGORYLIST_STATE" , result)
    }
}

const getters = {}

//暴露模块
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}